using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Web;

using Common;

namespace data
{
    public class userLibs
    {
        public static string lastErrorMessage = "";
        public static userDataSetTableAdapters.tm_usersTableAdapter userTA = new data.userDataSetTableAdapters.tm_usersTableAdapter();
        public static userDataSet.tm_usersDataTable usersTbl = new userDataSet.tm_usersDataTable();
        public static userDataSet.tm_usersRow userRow;
        public static userDataSet.tm_usersRow GetData(int userId)
        {
            userRow = null;
            try
            {
                userTA.FillByUserId(usersTbl, userId);
                if (usersTbl.Count < 0) return null;
                userRow = usersTbl[0];
            }
            catch (Exception ex)
            {
                lastErrorMessage = ex.Message.ToString();
            }
            return userRow;
        }
        public static userDataSet.tm_usersRow GetDataByAccount(string account)
        {
            userRow = null;
            try
            {
                userTA.FillByAccount(usersTbl, account);
                if (usersTbl.Count < 0) return null;
                userRow = usersTbl[0];
            }
            catch (Exception ex)
            {
                lastErrorMessage = ex.Message.ToString();
            }
            return userRow;
        }
        public static userDataSet.tm_usersRow GetDataByEmail(string email)
        {
            userRow = null;
            try
            {
                userTA.FillByEmail(usersTbl, email);
                if (usersTbl.Count < 0) return null;
                userRow = usersTbl[0];
            }
            catch (Exception ex)
            {
                lastErrorMessage = ex.Message.ToString();
            }
            return userRow;
        }
      }
}
